package com.ruoyi.jkcrData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jkcrData.domain.plat.DataJkcrZhchxx;
import com.ruoyi.jkcrData.domain.plat.JkcrZhchxxChange;
import com.ruoyi.jkcrData.service.IDataJkcrZhchxxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 架空乘人重车下行空车上行测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/jkcrData/zhchxx")
@Api(value="架空乘人-重车下行空车上行测试",tags = "架空乘人-重车下行空车上行接口")
public class DataJkcrZhchxxController extends BaseController
{
    @Autowired
    private IDataJkcrZhchxxService dataJkcrZhchxxService;

    /**
     * 查询架空乘人重车下行空车上行测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataJkcrZhchxx dataJkcrZhchxx)
    {
        startPage();
        List<DataJkcrZhchxx> list = dataJkcrZhchxxService.selectDataJkcrZhchxxList(dataJkcrZhchxx);
        return getDataTable(list);
    }

    /**
     * 导出架空乘人重车下行空车上行测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:export')")
    @Log(title = "架空乘人重车下行空车上行测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataJkcrZhchxx dataJkcrZhchxx)
    {
        List<DataJkcrZhchxx> list = dataJkcrZhchxxService.selectDataJkcrZhchxxList(dataJkcrZhchxx);
        ExcelUtil<DataJkcrZhchxx> util = new ExcelUtil<DataJkcrZhchxx>(DataJkcrZhchxx.class);
        util.exportExcel(response, list, "架空乘人重车下行空车上行测试数据数据");
    }

    /**
     * 获取架空乘人重车下行空车上行测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:query')")
    @GetMapping(value = "/{zhchxxId}")
    public AjaxResult getInfo(@PathVariable("zhchxxId") Long zhchxxId)
    {
        return success(dataJkcrZhchxxService.selectDataJkcrZhchxxByZhchxxId(zhchxxId));
    }

    /**
     * 新增架空乘人重车下行空车上行测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:add')")
    @Log(title = "架空乘人重车下行空车上行测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataJkcrZhchxx dataJkcrZhchxx)
    {
        return toAjax(dataJkcrZhchxxService.insertDataJkcrZhchxx(dataJkcrZhchxx));
    }

    /**
     * 修改架空乘人重车下行空车上行测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:edit')")
    @Log(title = "架空乘人重车下行空车上行测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataJkcrZhchxx dataJkcrZhchxx)
    {
        return toAjax(dataJkcrZhchxxService.updateDataJkcrZhchxx(dataJkcrZhchxx));
    }

    /**
     * 修改架空乘人重车下行空车上行测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:Zhchxx:edit')")
    @Log(title = "修改架空乘人重车下行空车上行测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/delZhchxx/{zhchxxId}")
    @ApiOperation(value="修改架空乘人重车下行空车上行测试数据")
    public AjaxResult delZhchxx(@PathVariable Long zhchxxId)
    {
        return toAjax(dataJkcrZhchxxService.updateDataJkcrZhchxxByZhchxxId(zhchxxId));
    }

    /**
     * 修改架空乘人-重车下行空车上行
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:modifyZhchxx:edit')")
    @Log(title = "修改架空乘人-重车下行空车上行", businessType = BusinessType.UPDATE)
    @PutMapping("/modifyZhchxx")
    @ApiOperation(value="修改架空乘人-重车下行空车上行")
    public AjaxResult modifyZhchxx(@ApiParam(name="重车下行空车上行数据",value="传入json格式",required=true)@RequestBody JkcrZhchxxChange jkcrZhchxxChange)
    {
        return AjaxResult.success(dataJkcrZhchxxService.modifyDataJkcrZhchxx(jkcrZhchxxChange));
    }


    /**
     * 删除架空乘人重车下行空车上行测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:zhchxx:remove')")
    @Log(title = "架空乘人重车下行空车上行测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zhchxxIds}")
    public AjaxResult remove(@PathVariable Long[] zhchxxIds)
    {
        return toAjax(dataJkcrZhchxxService.deleteDataJkcrZhchxxByZhchxxIds(zhchxxIds));
    }
}
